package com.xxx.flink.customsource;

import com.xxx.flink.pojo.Event;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * 测试自定义数据源
 * @author guwq
 * @since 2023/7/25
 */
public class CustomSourceTest {

    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);  // 设置全局并行度为1

        DataStreamSource<Event> customSourceStream = env.addSource(new CustomSource());

        customSourceStream.print();

        env.execute();
    }
}
